<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<META HTTP-EQUIV="pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate"> 
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"> 
<META HTTP-EQUIV="expires" CONTENT="0"> 
<jsp:include page="/common/commonCss.jsp"/>
<jsp:include page="/common/commonJs.jsp"/>

<title>嘉童游乐中心</title>
</head>
<script language="javascript">
var basePath = '${basePath}';

	function to_URL(){
		//window.top.main.src="top.html";
		var main = window.parent.document.getElementById("main");
		main.src="view/invoicing/invo_commodity.html";
	}
	function resizeFrame() {
		javascript:dyniframesize('main');
	}
	$(document).ready(function() {
		/* var path  = window.location.href;
		alert("path = "+ path); */
		var bran = "${loginBran}";
		var runFloor = "${runFloor}";
		var runScm = "${runScm}";
		if(bran != 'ZB' ){
			if(runFloor == '1'){
				warnFloor();
			}
			if(runScm == '1'){
				warnScm();
			}
		}
	});
	
	//场内人数预警 10分钟运行一次
	function warnFloor(){
		run();          
		var interval;
		function run() {  
            interval = setInterval(chat, "600000");  
         }  
         function chat() {  
        	 $.ajax({  
                 type: "get",  
                 url: basePath+"system/index/floorNum.shtml",  
                 cache: false,
     	        async: false,
     	        dataType: 'json',  
                 data: {},  //没参数可以删除
                 success: function (data) {
                	 var floorNum = parseInt(data.floorNum);
                	 var defalFloorNum = parseInt(data.defailFloorNum);
                	 if(floorNum > defalFloorNum){
                		 $("#floorNumSpan").text(floorNum);
                		 $('#floorNumDiv').window('open');
                	  }
                 } ,
                 error: function(){  
     	            return;  
     	        }  
             });  
         }  
	}
	
	//库存数量预警  120分钟运行一次 
	function warnScm(){
		run1();           
		var interval1;
		function run1() {  
            interval1 = setInterval(chat1, "7200000");  
         }  
         function chat1() {  
        	 $.ajax({  
                 type: "get",  
                 url: basePath+"system/index/scmCount.shtml",  
                 cache: false,
     	        async: false,
     	        dataType: 'json',  
                 data: {},  //没参数可以删除
                 success: function (data) {
                	 $("#showWarnScm").text("");
                	 var obj = data.indexScmCount;
                	 if(obj != null){
                		 var i = 0;
                		 $(obj).each(function(n){ 
                			 i++;
                			 var tVal = i+"."+this.prdName+" 剩余"+this.stgCnt;
                			 $("#showWarnScm").append("<p>"+tVal+"</p>"); 
                		 });
                		 if(i > 0){
                			 if(i==5){
                				 $("#showWarnScm").append("<p><b><a href=\"${basePath }StockQuery/toStockQuery.shtml\" onclick=\"javascript:$('#scmCountDiv').window('close');\" target=\"main\">更多...</a></b></p>"); 
                			 }
                			 $('#scmCountDiv').window('open');
                		 }
                	 }
                 } ,
                 error: function(){  
     	            return;  
     	        }  
             });  
         }  
	}
	$(document).ready(function(){
		var meuns = eval('${meuns}');
		initMenu(meuns);
	});
	
	function initMenu(munus) {
		$("#nav").children().remove();
		var menuStr = "";
		var str = recursiveMenu(menuStr, munus);
		$("#nav").append(str);
	}

	function recursiveMenu(menuStr, munus) {
		if (munus != null && munus.length > 0) {
			for (var i = 0; i < munus.length; i++) {
				var o = munus[i];
				
				var hasChildren = o.children != null && o.children.length > 0;
				
				var str="";
				
				if(hasChildren){
					str+="<span class=\"navMore\">"+o.desc+"<b></b>";
					str += "<ul  class=\"navMoreUl\">";
					str += getChildLi(o.children);
					str += "</ul>";
				}else{
					str+= "<li><a href=\""+basePath+"system/index/urlauth/"+o.id+".shtml\" target=\"main\">";
					str+="<i class=\""+o.cssName+"\"></i>";
					str+=o.desc;
					str+="</a></li>";
				}
				menuStr += str;
			}
		}
		return menuStr;
	}
	
	function getChildLi(children){
		var li="";
		$.each(children,function(ind,obj){
			li+="<li><a href=\""+basePath+"system/index/urlauth/"+obj.id+".shtml\" target=\"main\">"+obj.desc+"</a></li>";
		});
		return li;
	}
	
</script>
<body>
<div class="head">
	<div class="m_auto_x fixed">
        <ul class="nav" id="nav">
            <li><a href="${basePath }system/index.shtml" target="main"><i class="make_icon"></i>首页</a></li>
            <li><a href="${basePath }membership/single/jumpSingleTicket.shtml" target="main"><i class=" file_icon"></i>购票/会籍/预约</a></li>
            <li><a href="${basePath}filemanagement/listVip.shtml?type=1" target="main"><i class="site_icon"></i>档案管理</a></li>
            <li><a href="${basePath}management/site/locPerManager.shtml?type=1" target="main"><i class="home_icon"></i>现场管理</a></li>
            <li><a href="${basePath }goods/list.shtml" target="main"><i class="xita_icon"></i>商品销售</a></li> 
            <li><a href="${basePath}payment/skmx.shtml" target="main"><i class="xitb_icon"></i>收银</a></li>
	    <li><a href="${basePath }scmInvocing/productInfo/forwardToProductInfo.shtml" target="main"><i class="xitc_icon"></i>采购管理</a></li> 
            <li><a href="${basePath }StockGoodsIn/toStock_goodsIn.shtml" target="main"><i class="xitd_icon"></i>仓储管理</a></li>
	    <li><a href="${basePath}promotion/home.shtml" target="main"><i class="xite_icon"></i>促销管理</a></li>
            <li><a href="${basePath}report/jump.shtml" target="main"><i class="xite_icon"></i>报表</a></li>
            <span class="navMore">更多<b></b>
                <ul class="navMoreUl">
                    <li>
						<a href="${basePath}authority/role/home.shtml" target="main">系统管理</a>
					</li>
                    <li><a href="#">超链接</a></li>
                    <li><a href="#">超链接</a></li>
                    <li><a href="${basePath}signClass/memClass.shtml">课程签到表</a></li>
                    <li><a href="${basePath}sms/batch/home.shtml">短信发送</a></li>
                </ul>
            </span>
			<!---<li><a href="javascript:alert('开发中……');" target="main"><i class="xito_icon"></i></a></li>--->
        </ul>
        <div class="fr mr10">
                <span class="navMorex mr10"><i class="land_icon"></i>
                    <div class="navMoreUlx"><shiro:principal></shiro:principal></div>
                </span>
                <a class="mt10" href="logout.shtml"><i class="close_icon mr5"></i>退出</a>
            </div>
    </div>
</div>
<div id="floorNumDiv" class="easyui-window" title="场内人数提醒" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:370px; height:200px; position:relative;">
    
    <div style="margin: 60px 0 0 80px;font-size:15px;">场内人数超限，目前场内总人数：<span class="color_red" id="floorNumSpan"></span></div>
    
    <div class="btm_btn btm_bg">
    	<dl>
        	<dd><input type="button" class="btn" onClick="$('#floorNumDiv').window('close')" value="确定" /></dd>
        </dl>
    </div>
</div>

<div id="scmCountDiv" class="easyui-window" title="库存数量提醒" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:490px; height:300px; position:relative;">
    
    <div class="jingg">商品库存预警,以下商品库存数量已低于最低库存警戒线：</br><div id="showWarnScm"></div></div>
    
    <div class="btm_btn btm_bg">
    	<dl>
        	<dd><input type="button" class="btn" onClick="$('#scmCountDiv').window('close')" value="确定" /></dd>
        </dl>
    </div>
</div>

 <iframe src ="${basePath }system/index.shtml" frameborder="0" marginheight="0" marginwidth="0" frameborder="0" scrolling="no" id="main" name="main" onload="javascript:resizeFrame();" width="100%" style="overflow-x:hidden; width:100%">
</iframe> 
<!-- 
<iframe name="main" id="main" src="${basePath }index.shtml" frameborder="0" scrolling="no" width="100%" height="710px"></iframe> -->
</body>
</html>
